

namespace gen {

	template <typename ContextT>
    template <typename CondT>
    inline condition<ContextT> &
	condition<ContextT>::operator=(CondT const& c)
    {
        ptr.reset(new concrete_condition<CondT, context_t>(c));
        return *this;
    }

	template <typename ContextT>
    inline condition<ContextT>&
	condition<ContextT>::operator=(condition const& f)
    {
        ptr.reset(new concrete_condition<condition, context_t>(f));
        return *this;
    }

	template <typename ContextT>
    inline condition<ContextT>
	condition<ContextT>::copy() const
    {
        return condition<ContextT>(ptr.get() ? ptr->clone() : 0);
    }



    template <
        typename DerivedT,       // derived class
        typename EmbedT,         // how derived class is embedded
        typename ContextT
    >
	domain<typename ContextT::iterator_t>
	condition_base<DerivedT,EmbedT,ContextT>::evaluate(ContextT const& c) const
    {
        domain<typename ContextT::iterator_t> d(c.domain().first(), c.domain().last(), false_initializator());
		DerivedT const* derived_this = static_cast<DerivedT const*>(this);
        if (condition_base_access::get(*derived_this))
        {
            d = condition_base_access::get(*derived_this)
                    ->do_evaluate_virtual(c);
        }
        return d;
    }


}

